<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<input type="text" name="" id="" value="" /><br><br>
		<input type="text" name="" id="" value="" /><br><br>
		<input type="text" name="" id="" value="" /><br><br>
		<input type="text" name="" id="" value="" /><br><br>
		<input type="text" name="" id="" value="" /><br><br>
		<input type="text" name="" id="" value="" /><br><br>
		
		<button type="button">赋值</button><br><br>
		<button type="button">取值</button><br><br>
		
		<script type="text/javascript">
			var inpArr = document.getElementsByTagName("input");
			var btnArr = document.getElementsByTagName("button");
			
			btnArr[0].onclick = function () {
				for(var i = 0;i<inpArr.length;i++){
					inpArr[i].value = i;
				}
			}
			
			
			btnArr[1].onclick = function () {
				var newArr = [];
				for(var i = 0;i<inpArr.length;i++){
					newArr.push(inpArr[i].value);
				}
				console.log(newArr.join(""));
			}
		</script>
	</body>
</html>
